package com.example.demo.mySynchronized;

public class SynchronizedDemo {


    private static final Object lock = new Object();


    public synchronized void test(){
        System.out.println("say hello");
    }


    public static void main(String[] args) {
        synchronized (lock){
            System.out.println("hello world");
        }
    }

}
